VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "msmask32.ocx"
Begin VB.Form frmCuentasContablesEmpleados 
   BackColor       =   &H80000013&
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   9060
   ClientLeft      =   15
   ClientTop       =   15
   ClientWidth     =   10770
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   9060
   ScaleWidth      =   10770
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command1 
      BackColor       =   &H80000013&
      Caption         =   "Listado de Empleados Activos que les Falta alguna Cuenta Contable"
      Height          =   255
      Left            =   360
      MaskColor       =   &H0080FFFF&
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   8520
      Width           =   8055
   End
   Begin VB.CommandButton CmdGuardar 
      BackColor       =   &H0080C0FF&
      Caption         =   "Guardar"
      Height          =   375
      Left            =   8640
      MouseIcon       =   "frmCuentasContablesEmpleados.frx":0000
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   4680
      Width           =   1575
   End
   Begin MSMask.MaskEdBox mskSueldo 
      Height          =   375
      Left            =   8640
      TabIndex        =   0
      Top             =   2640
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   0
      MaxLength       =   14
      Mask            =   "#-#-#-##-##-##"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskVacacion 
      Height          =   375
      Left            =   8640
      TabIndex        =   1
      Top             =   3360
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   0
      MaxLength       =   14
      Mask            =   "#-#-#-##-##-##"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskHorasExtras 
      Height          =   375
      Left            =   8640
      TabIndex        =   2
      Top             =   4080
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   0
      MaxLength       =   14
      Mask            =   "#-#-#-##-##-##"
      PromptChar      =   "_"
   End
   Begin MSComctlLib.ListView vistaEmpleados 
      Height          =   6015
      Left            =   360
      TabIndex        =   8
      Top             =   2400
      Width           =   8025
      _ExtentX        =   14155
      _ExtentY        =   10610
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      _Version        =   393217
      ForeColor       =   8388608
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   0
   End
   Begin VB.Line Line1 
      X1              =   600
      X2              =   10320
      Y1              =   720
      Y2              =   720
   End
   Begin VB.Image cmdSalir 
      Height          =   480
      Left            =   1920
      MouseIcon       =   "frmCuentasContablesEmpleados.frx":030A
      MousePointer    =   99  'Custom
      Picture         =   "frmCuentasContablesEmpleados.frx":0614
      ToolTipText     =   "Salir de esta pantalla"
      Top             =   1680
      Width           =   480
   End
   Begin VB.Image cmdAgregar 
      Height          =   480
      Left            =   480
      MouseIcon       =   "frmCuentasContablesEmpleados.frx":091E
      MousePointer    =   99  'Custom
      Picture         =   "frmCuentasContablesEmpleados.frx":0C28
      ToolTipText     =   "Agregar"
      Top             =   1680
      Width           =   480
   End
   Begin VB.Image CmdBorrar 
      Height          =   480
      Left            =   1200
      MouseIcon       =   "frmCuentasContablesEmpleados.frx":14F2
      MousePointer    =   99  'Custom
      Picture         =   "frmCuentasContablesEmpleados.frx":17FC
      ToolTipText     =   "Borrar "
      Top             =   1680
      Width           =   480
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "Horas Extras"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   8640
      TabIndex        =   7
      Top             =   3840
      Width           =   1215
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "Sueldo"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   8640
      TabIndex        =   6
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Vacaciones"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   8640
      TabIndex        =   5
      Top             =   3120
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "CUENTAS CONTABLES - EMPLEADOS ACTIVOS"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00404080&
      Height          =   375
      Left            =   480
      TabIndex        =   4
      Top             =   240
      Width           =   9975
   End
End
Attribute VB_Name = "frmCuentasContablesEmpleados"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdAgregar_Click()
    Accion = "I"
    frmAgregarEmpleado.Show 1
    LlenarVista
End Sub

Private Sub CmdBorrar_Click()
  'DE.MCuentasContablesEmpleados Accion, Trim(Me.vistaEmpleados.SelectedItem.Text), Me.mskSueldo.Text, Me.mskVacacion.Text, Me.mskHorasExtras
  
   On Error GoTo Errores

    
    
        Dim Confirmar As Integer
        Confirmar = MsgBox("Desea Borrar el Registro Seleccionado?", vbYesNo + vbQuestion + vbDefaultButton2)
        If Confirmar = vbYes Then
             'Verificar que las cuenta existan
        
            DE.MCuentasContablesEmpleados "D", Trim(Me.vistaEmpleados.SelectedItem.Text), "", "", ""
           
        End If
        LlenarVista

   

Exit Sub
Errores:
    Errores Err, error

End Sub

Private Sub CmdGuardar_Click()
    On Error GoTo Mierror
    
    

 
    Set rscuenta = New ADODB.Recordset

        Dim Confirmar As Integer
        Confirmar = MsgBox("Desea Guardar los datos?", vbYesNo + vbQuestion + vbDefaultButton2)
        If Confirmar = vbYes Then
             
'            If Me.mskHorasExtras.Text = "_-_-_-__-__-__" Then
'            End If
'            If Me.mskHorasExtras.Text = "_-_-_-__-__-__" Then
'            End If
'            If Me.mskHorasExtras.Text = "_-_-_-__-__-__" Then
'            End If
             
        'Verificar que las cuenta existan
         If DE.rsplaPKEmpleados.State = adStateOpen Then DE.rsplaPKEmpleados.Close
            DE.plaPKEmpleados Trim(Me.vistaEmpleados.SelectedItem.Text)
        
            With DE.rsplaPKEmpleados
                If Not .EOF Then
                    tipoplanilla = .Fields("iCodigo_TipoPlanilla")
               End If
            End With
              
            If tipoplanilla = 2 Or tipoplanilla = 4 Or tipoplanilla = 17 Or tipoplanilla = 8 Or tipoplanilla = 10 Or _
                tipoplanilla = 11 Or tipoplanilla = 9 Or tipoplanilla = 3 Or tipoplanilla = 5 Or _
                tipoplanilla = 12 Or tipoplanilla = 20 Or tipoplanilla = 19 Then
                Empresa = 1
            End If
            
              
            If tipoplanilla = 6 Or tipoplanilla = 22 Or tipoplanilla = 23 Or tipoplanilla = 24 Or tipoplanilla = 25 Then
                    Empresa = 4
            End If
            
            'verifico que Exista la cuenta para las  Hora extras
            If Me.mskHorasExtras.Text <> "_-_-_-__-__-__" Then
                rscuenta.Open "Select * from SACF_contpresupuesto..cypCatalogoCuenta where (tNumEmpresa=" & Empresa & ") and (cNumCuenta='" & Me.mskHorasExtras.Text & "')", DE.Cnn, adOpenDynamic, adLockReadOnly
                If rscuenta.RecordCount <> 0 Then
                     existecuenta = True
                  Else
                     existecuenta = False
                 End If
                   
                   If existecuenta = False Then
                    MsgBox "Este Numero de cuenta para las horas extras no existe"
                    Exit Sub
                   End If
                   rscuenta.Close
            End If
            
            
            'verifico que Exista la cuenta para el sueldo
            If Me.mskSueldo.Text <> "_-_-_-__-__-__" Then
               rscuenta.Open "Select * from SACF_contpresupuesto..cypCatalogoCuenta where (tNumEmpresa=" & Empresa & ") and (cNumCuenta='" & Me.mskSueldo.Text & "')", DE.Cnn, adOpenDynamic, adLockReadOnly
               If rscuenta.RecordCount <> 0 Then
                  existecuenta = True
                Else
                  existecuenta = False
                End If
                   
                 If existecuenta = False Then
                   MsgBox "Este Numero de cuenta para el sueldo no existe"
                   Exit Sub
                 End If
                 rscuenta.Close
            End If

            
              
            
            'verifico que Exista la cuenta para la vacacio
            If Me.mskVacacion.Text <> "_-_-_-__-__-__" Then
                rscuenta.Open "Select * from SACF_contpresupuesto..cypCatalogoCuenta where (tNumEmpresa=" & Empresa & ") and (cNumCuenta='" & Me.mskVacacion.Text & "')", DE.Cnn, adOpenDynamic, adLockReadOnly
                If rscuenta.RecordCount <> 0 Then
                     existecuenta = True
                  Else
                     existecuenta = False
                 End If
                   
                   If existecuenta = False Then
                    MsgBox "Este Numero de cuenta para la vacacion  no existe"
                    Exit Sub
                   End If
                   rscuenta.Close
            End If

          
        
            DE.MCuentasContablesEmpleados Accion, Trim(Me.vistaEmpleados.SelectedItem.Text), Me.mskSueldo.Text, Me.mskVacacion.Text, Me.mskHorasExtras
            
        End If
        LlenarVista
  

Exit Sub
Mierror:
    MsgBox "Ya existe la asignacion que desea hacer"

End Sub

Private Sub CmdSalir_Click()
    Unload Me
End Sub

Private Sub Command1_Click()
    
        RutaReportes = DE.rsGENCParametros.Fields("RUTA_REPORTES")
        Imprimir RutaReportes & "LOSQUEFALTAN.rpt", "", "", "", ""
            
End Sub

Private Sub Form_Load()
    Me.mskHorasExtras.Enabled = False
    Me.mskSueldo.Enabled = False
    Me.mskVacacion.Enabled = False
    CmdGuardar.Enabled = False
    
    
   Me.vistaEmpleados.ColumnHeaders.Add , , "Cod. ", 0
   Me.vistaEmpleados.ColumnHeaders.Add , , "Nombre", 4500
   Me.vistaEmpleados.ColumnHeaders.Add , , "Planilla ", 3500
   Me.vistaEmpleados.ColumnHeaders.Add , , "Cod.Planilla", 0
   Me.vistaEmpleados.ColumnHeaders.Add , , "CuentaSueldo. ", 0
   Me.vistaEmpleados.ColumnHeaders.Add , , "CuentaVacaciones", 0
   Me.vistaEmpleados.ColumnHeaders.Add , , "CuentaHextras", 0
   
   Me.vistaEmpleados.View = lvwReport
   Me.vistaEmpleados.GridLines = True
   

    LlenarVista
End Sub

Private Sub mskHorasExtras_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub mskSueldo_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub mskVacacion_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub vistaEmpleados_BeforeLabelEdit(Cancel As Integer)
    On Error Resume Next
        Me.mskSueldo.Text = "_-_-_-__-__-__"
        Me.mskVacacion.Text = "_-_-_-__-__-__"
        Me.mskHorasExtras.Text = "_-_-_-__-__-__"
   CodigoE = Trim(Me.vistaEmpleados.SelectedItem.Text)
         Me.mskSueldo.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(4)
         Me.mskVacacion.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(5)
         Me.mskHorasExtras.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(6)
         
End Sub

Private Sub vistaEmpleados_Click()
        On Error Resume Next
        Me.mskSueldo.Text = "_-_-_-__-__-__"
        Me.mskVacacion.Text = "_-_-_-__-__-__"
        Me.mskHorasExtras.Text = "_-_-_-__-__-__"
         CodigoE = Trim(Me.vistaEmpleados.SelectedItem.Text)
         Me.mskSueldo.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(4)
         Me.mskVacacion.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(5)
         Me.mskHorasExtras.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(6)
         
End Sub

Private Sub vistaEmpleados_DblClick()
    Me.mskHorasExtras.Enabled = True
    Me.mskSueldo.Enabled = True
    Me.mskVacacion.Enabled = True
    CmdGuardar.Enabled = True
      
    CodigoE = Trim(Me.vistaEmpleados.SelectedItem.Text)
    
    mskSueldo.SetFocus
    Accion = "U"
    
End Sub
Private Sub LlenarVista()
On Error Resume Next

    Me.mskHorasExtras.Enabled = False
    Me.mskSueldo.Enabled = False
    Me.mskVacacion.Enabled = False
    CmdGuardar.Enabled = False

 Dim itmX As ListItem
   
    Me.vistaEmpleados.ListItems.Clear
    
    If DE.rsCuentasContablesEmpleas.State = adStateOpen Then DE.rsCuentasContablesEmpleas.Close
    DE.CuentasContablesEmpleas
   
   If DE.rsCuentasContablesEmpleas.RecordCount <> 0 Then
      
      
      While Not DE.rsCuentasContablesEmpleas.EOF
         Set itmX = Me.vistaEmpleados.ListItems.Add(, , Trim(DE.rsCuentasContablesEmpleas.Fields("codigo_empleado").Value))
         itmX.SubItems(1) = DE.rsCuentasContablesEmpleas.Fields("nombres").Value
         itmX.SubItems(2) = DE.rsCuentasContablesEmpleas.Fields("vDescripcion_TipoPlanilla").Value
         itmX.SubItems(3) = DE.rsCuentasContablesEmpleas.Fields("iCodigo_TipoPlanilla").Value
         itmX.SubItems(4) = DE.rsCuentasContablesEmpleas.Fields("CuentaSueldo").Value
         itmX.SubItems(5) = DE.rsCuentasContablesEmpleas.Fields("CuentaVacaciones").Value
         itmX.SubItems(6) = DE.rsCuentasContablesEmpleas.Fields("CuentaHextras").Value
         
         DE.rsCuentasContablesEmpleas.MoveNext
      Wend

      Else
        Me.vistaEmpleados.Enabled = False
   End If
End Sub

Private Sub vistaEmpleados_ItemClick(ByVal Item As MSComctlLib.ListItem)
    On Error Resume Next
        Me.mskSueldo.Text = "_-_-_-__-__-__"
        Me.mskVacacion.Text = "_-_-_-__-__-__"
        Me.mskHorasExtras.Text = "_-_-_-__-__-__"
         CodigoE = Trim(Me.vistaEmpleados.SelectedItem.Text)
         Me.mskSueldo.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(4)
         Me.mskVacacion.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(5)
         Me.mskHorasExtras.Text = Me.vistaEmpleados.SelectedItem.ListSubItems(6)

End Sub
